﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Helpers;

namespace VoteUphold
{
    public class EmailInfo
    {
        /// <summary>
        /// 163主机
        /// </summary>
        public const string HOST_163 = "smtp.163.com";
        /// <summary>
        /// 端口
        /// </summary>
        public const int PROT_163 = 25;
       
        public UserInfo UserInfo { get; set; }

        public static string BinarySerialize(UserInfo userInfo)
        {
            return SerializeHelper.BinarySerialize(userInfo);
        }

        public static UserInfo GetUserInfo(string base64String)
        {
           return SerializeHelper.BinaryDeserialize<UserInfo>(base64String);
        }

        //
        /// <summary>
        ///  
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        private int GetGTK(string skey)
        {
            var hash = 5381;
            if (!string.IsNullOrEmpty(skey))
            {
                for (int i = 0, len = skey.Length; i < len; ++i)
                {
                    hash += (hash << 5) + (char)skey[i];
                }
            }
            return hash & 0x7fffffff;
        }
    }

    /// <summary>
    /// 邮箱信息
    /// </summary>
     [Serializable]
    public class UserInfo
    {
        /// <summary>
        /// adress  userName
        /// </summary>
        public string UserName { get; set; }
        /// <summary>
        ///adress  displayName
        /// </summary>
        public string DisplayName { get; set; }
        /// <summary>
        ///adress  pwasword
        /// </summary>
        public string Password { get; set; }

    }
}
